package com.space.user.service;

import com.space.client.api.AccountServiceI;
import com.space.client.dto.UserAccountInfoDTO;
import com.space.user.assembler.UserAccountAssembler;
import com.space.user.domain.account.service.UserAccountDomainService;
import com.space.user.domain.account.valueobject.UserId;
import org.apache.dubbo.config.annotation.DubboService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.validation.annotation.Validated;

/**
 * @author <a href="mailto:414563035@qq.com">Bedroom</a>
 * @date 2021/4/17 7:19 下午
 */
@DubboService
@Service
@Validated
public class AccountServiceImpl implements AccountServiceI {
    @Autowired
    UserAccountDomainService userAccountDomainService;
    @Autowired
    UserAccountAssembler userAccountAssembler;

    @Override
    public UserAccountInfoDTO getUserAccountInfo(Integer userId) {
        return userAccountAssembler.toDTO(userAccountDomainService.getAccountInfo(new UserId(userId)));
    }
}
